package org.my;

/**
 * 用于测试 AOP 框架的类，包含不同类型的方法
 */
public class AopTester {

    static {
        System.out.println("Executing static block...");
    }

    /**
     * 静态方法
     */
    public static void staticMethod() {
        System.out.println("Executing staticMethod...");
    }

    /**
     * 构造方法
     */
    public AopTester() {
        System.out.println("Executing constructor...");
    }

    /**
     * 普通方法
     */
    public void normalMethod() {
        System.out.println("Executing normalMethod...");
    }

    /**
     * final 方法
     */
    public final void finalMethod() {
        System.out.println("Executing finalMethod...");
    }

    /**
     * 私有方法
     */
    private void privateMethod() {
        System.out.println("Executing privateMethod...");
    }

    /**
     * protected 方法
     */
    protected void protectedMethod() {
        System.out.println("Executing protectedMethod...");
    }

    /**
     * 抛出异常的普通方法
     */
    public void methodWithException() throws Exception {
        System.out.println("Executing methodWithException...");
        throw new Exception("Exception of methodWithException");
    }

    /**
     * 带返回值的方法
     */
    public String methodWithReturnValue(String arg) {
        System.out.println("Executing methodWithReturnValue...");
        return "Hello, " + arg;
    }

    /**
     * 方法重载
     */
    public void overloadedMethod(String arg) {
        System.out.println("Executing overloadedMethod with arg: " + arg);
    }

    /**
     * 方法重载
     */
    public void overloadedMethod(int arg) {
        System.out.println("Executing overloadedMethod with param: " + arg);
    }
}
